package com.higgins.client.generic.components;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;

public class GenericColumns		{
	private static final Logger log = Logger.getLogger(GenericColumns.class.getName());
	private List<GenericColumn> columns = new ArrayList<GenericColumn>();
	private String retrieveMethod = null;
	private String updateMethod = null;
	private Boolean editable = false;

	public GenericColumns()			{

	}
	public Iterator<GenericColumn> getIterator()	{
		return columns.iterator();
	}
	public List<GenericColumn> getColumns()	{
		return columns;
	}
	public GenericColumn getColumn(Integer index)	{
		if (columns.size() > index)	{
			return columns.get(index);
		}
		return null;
	}
	public void addColumn(GenericColumn column)	{
		columns.add(column);
	}
	public void setRetrieveMethod(String retrieveMethod)	{
		this.retrieveMethod = retrieveMethod;
	}
	public String getRetrieveMethod()	{
		return retrieveMethod;
	}
	public void setUpdateMethod(String updateMethod)	{
		this.updateMethod = updateMethod;
	}
	public String getUpdateMethod()	{
		return updateMethod;
	}
	public void setEditable(Boolean editable)	{
		this.editable = editable;
	}
	public Boolean getEditable()	{
		return editable;
	}
	public Integer getWidth()	{
		Integer width = 0;
		for (GenericColumn column:columns)	{
			width = width + column.getWidth();
		}
		return width;
	}
}
